#include "stdafx.h"
#include "client.h"
#include "ReportRecord.h"

////////////////////////////////////////////////////////////////////////////////////////////////////////
CDateTimeRecordItem::CDateTimeRecordItem()
{
	m_nTime = 0;
	__super::SetValue("");
}
CDateTimeRecordItem::CDateTimeRecordItem(UINT nValue)
{
	SetValue(nValue);
}
CDateTimeRecordItem::~CDateTimeRecordItem()
{

}
void CDateTimeRecordItem::SetValue(UINT nValue)
{
	m_nTime = nValue;

	CTime tTime = m_nTime;	
	__super::SetValue(tTime.Format("%Y-%m-%d %H:%M:%S"));
}
int CDateTimeRecordItem::Compare(CXTPReportColumn* pColumn, CXTPReportRecordItem* pItem)
{
	CDateTimeRecordItem* pNeetItem = dynamic_cast<CDateTimeRecordItem*>(pItem);

	if (pNeetItem == NULL)
	{
		if (pItem != NULL)
		{
			return m_pRecord->GetRecords()->Compare(GetCaption(pColumn), pItem->GetCaption(pColumn));
		}
		return 0;
	}

	return m_nTime - pNeetItem->m_nTime;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
IMPLEMENT_SERIAL(CCheckRecordItem, CXTPReportRecordItem, VERSIONABLE_SCHEMA | _XTP_SCHEMA_CURRENT)

void CCheckRecordItem::OnClick(XTP_REPORTRECORDITEM_CLICKARGS* pClickArgs)
{
	CXTPReportRecordItem::OnClick(pClickArgs);	
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
IMPLEMENT_DYNAMIC(CReportRecord, CXTPReportRecord)


CReportRecord::CReportRecord()
{
}

CReportRecord::~CReportRecord()
{
}


BEGIN_MESSAGE_MAP(CReportRecord, CXTPReportRecord)
END_MESSAGE_MAP()

void CReportRecord::GetItemMetrics(XTP_REPORTRECORDITEM_DRAWARGS *pDrawArgs, XTP_REPORTRECORDITEM_METRICS *pItemMetrics)
{
	if(pDrawArgs->pRow->GetIndex() % 2 == 0)
		pItemMetrics->clrBackground = RGB(248, 248, 248);
	else
		pItemMetrics->clrBackground = RGB(242, 242, 242);
	pItemMetrics->clrForeground = RGB(10, 10, 10);
}
